st = "shanghaiwoniuxuyuanwn15huanyingni!"

dct = {}

while len(st):
    num = st.count(st[0])
    dct[st[0]] = num
    # replace 返回替换后的新字符串
    st = st.replace(st[0],"")
print(dct)